package com.sias.swagger.common;

import lombok.Data;

/**
 * @author 吴文杰
 * @version 1.0
 * @createTime 2023-05-19 20:40:42
 */
@Data
public class BaseResponse<T> {
  private int code;
  private String message;
  private T data;

  public BaseResponse(int code, String message, T data) {
    this.code = code;
    this.message = message;
    this.data = data;
  }

  public BaseResponse(ErrorCode errorCode, T data) {
    this(errorCode.getCode(), errorCode.getMessage(), data);
  }

  public BaseResponse(int code, T data) {
    this(code, "", data);
  }

  public BaseResponse(ErrorCode errorCode) {
    this(errorCode.getCode(), errorCode.getMessage(), null);
  }

}
